package com.ctosb.classviewer.clazz.attr;

import com.ctosb.classviewer.ClassReader;
import com.ctosb.classviewer.clazz.AbstractParse;
import com.ctosb.classviewer.clazz.Parseable;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class Bootstrap_method extends AbstractParse {

    private short bootstrap_method_ref;
    private short num_bootstrap_arguments;
    private short bootstrap_arguments[];

    @Override
    public Bootstrap_method parse(ClassReader classReader) {
        bootstrap_method_ref = classReader.readShort();
        num_bootstrap_arguments = classReader.readShort();
        bootstrap_arguments = new short[num_bootstrap_arguments & 0xffff];
        for (int i = 0; i < bootstrap_arguments.length; i++) {
            bootstrap_arguments[i] = classReader.readShort();
        }
        return this;
    }
}
